package model;

import javax.swing.*;
import view.Mainframe;

public class Panelswitcher extends JPanel{
	
	private static Panelswitcher instance;
	private JPanel currentpanel = Mainframe.getInstance().getMainpanel();
	
	public static Panelswitcher getInstance(){
		if(instance == null){
			instance = new Panelswitcher();
		}
		return instance;
	}

	public void SwitchPanel(JPanel panel){
		Mainframe.getInstance().getMainpanel().setVisible(false);
		currentpanel = panel;
		Mainframe.getInstance().setMainpanel(currentpanel);
		Mainframe.getInstance().add(currentpanel);
		currentpanel.setVisible(true);
	}	
}
